COBOL代码不能编译和创建可执行文件 您所在的位置:网站首页 cobol pic zz9 COBOL代码不能编译和创建可执行文件

COBOL代码不能编译和创建可执行文件

2022-10-26 10:44| 来源: 网络整理| 查看: 265

我正在尝试为给定的输入文件创建一个报告,其中我应该仔细检查每条记录,以确定它是否无法满足特定的标准。我现在面临的问题是cob文件无法编译,即使它在命令窗口中编译时没有显式地显示任何错误,也没有创建可执行文件。我想知道你们中是否有人能帮我找出代码中的错误所在。

Identification Division. Program-ID. lab5. Environment Division. Input-Output Section. File-Control. Select PayrollFile Assign to "lab5-in.dat" Organization is Line Sequential. Select OutputReport Assign to "lab5-out.dat" Organization is Line Sequential. Data Division. File Section. FD PayrollFile. 01 Input-Rec. 05 Rec-RegionNum Pic X(2). 05 Rec-RegionName Pic X(15). 05 Rec-DeptNum Pic X(5). 05 Rec-DeptName Pic X(30). 05 Rec-EmployeeNum Pic X(5). 05 Rec-LastName Pic X(20). 05 Rec-FirstName Pic X(15). 05 Rec-Gender Pic X. 05 Rec-Address Pic X(20). 05 Rec-CityState Pic X(20). 05 Rec-Title Pic X(20). 05 Rec-DOB Pic 9(8). 05 Rec-DOH. 10 RecDOH-YYYY Pic 9(4). 10 RecDOH-MM Pic 9(2). 10 RecDOH-DD Pic 9(2). 05 Rec-Marital Pic X. 05 Rec-Deps Pic 99. 05 Rec-SD Pic X(3). 05 Rec-Ins Pic X(3). 05 Rec-401k Pic V999. 05 Rec-PayCode Pic X. 05 Rec-Pay Pic 9(7)V9(2). 05 Rec-HrsPerWeek Pic 9(2)V9(2). 05 Rec-CommissionRate Pic V999. 05 Rec-ActualSales Pic 9(7)V9(2). FD OutputReport. 01 Output-Rec Pic X(210). Working-Storage Section. 01 WS-EmployeeNum Pic X(5). 01 WS-DeptName Pic X(30). 01 WS-Gender Pic X. 88 ValidGender Values "M" "m" "F" "f". 01 WS-Marital Pic X. 88 ValidMarital Values "D" "d" "M" "m" "P" "p" "S" "s" "W" "w". 01 WS-PayCode Pic X. 88 ValidPayCode Values "C" "c" "H" "h" "S" "s". 01 WS-HrsPerWeek Pic S9(2)V9(2). 01 WS-Pay Pic S9(7)V9(2). 01 WS-DOH. 10 DOH-YYYY Pic 9(4). 10 DOH-MM Pic 9(2). 10 DOH-DD Pic 9(2). 01 WS-SD Pic X(3). 01 WS-Date. 05 WS-YYYY Pic 9(4). 05 WS-MM Pic 9(2). 05 WS-DD Pic 9(2). 01 EndOfFileIndicator Pic X. 88 EOF Value "Y" When Set To False is "N". 01 Total-Line. 05 Pic X(25) Value "Total errors: ". 05 TL-TotalE Pic ZZ9. 01 TotalRE-Line. 05 Pic X(50) Value "Total record with errors: ". 05 TL-TotalRE Pic ZZ9. 01 TotError Pic 9(3). 01 TotRecordError Pic 9(3). 01 CurrentRec Pic X(208). 01 Blank-Line Pic X Value Spaces. 01 Report-Fields. 05 PageNumber Pic 99 Value 0. 05 LinesPerPage Pic 99 Value 35. 05 LineNumber Pic 99 Value 99. Procedure Division. 000-MAIN. Perform 100-initialize Perform until EOF Read PayrollFile At End Set EOF to True not at end perform 300-process End-read End-perform Perform 900-finalize Close PayrollFile OutputReport Stop Run. 100-initialize. Perform 110-open-files Move Zero to TotError Move Zero to TotRecordError. 110-open-files. Open Input PayrollFile Open Output OutputReport. 300-Process. Move Input-Rec to CurrentRec Move Rec-EmployeeNum to WS-EmployeeNum Move Rec-DeptName to WS-DeptName Move Rec-Gender to WS-Gender Move Rec-Marital to WS-Marital Move Rec-PayCode to WS-PayCode Move Rec-HrsPerWeek to WS-HrsPerWeek Move Rec-Pay to WS-Pay Move Rec-DOH to WS-DOH Perform 400-check. 400-check. If WS-EmployeeNum is Not Numeric Add 1 to TotError TotRecordError End-If If WS-DeptName Is Not Alphabetic Add 1 to TotError TotRecordError End-If If Not ValidGender Add 1 to TotError TotRecordError End-If If Not ValidMarital Add 1 to TotError TotRecordError End-If If Not ValidPayCode Add 1 to TotError TotRecordError End-If If WS-HrsPerWeek Is Negative And >= 60 Add 2 to TotError Add 1 to TotRecordError End-If If WS-HrsPerWeek Is Negative Or >=60 Add 1 to TotError TotRecordError End-If If WS-Pay Is Not Numeric and Is Negative Add 2 to TotError Add 1 to TotRecordError End-If If WS-Pay Is Negative Or Not Numeric Add 1 to TotError TotRecordError End-If If Function Test-Date-YYYYMMDD(WS-DOH) Is Not Zero Or WS-DOH Is Not Numeric Add 1 to TotError TotRecordError End-If. 900-finalize. perform 950-print-grand-total. 950-print-grand-total. Write Output-Rec from Blank-Line After advancing 1 line Move TotError to TL-TotalE Write Output-Rec from Total-Line after advancing 1 line Move TotRecordError to TL-TotalRE Write Output-Rec from TotalRE-Line after advancing 1 line.


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有